package com.th.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ThreePure
 * @date 2022/4/21 18:51
 * @description: TODO
 * @since 1.8
 */
@Controller
public class DruidTest {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @GetMapping("/sql")
    @ResponseBody
    public String queryFromDb(){
        Long count = jdbcTemplate.queryForObject("select count(*) from users", Long.class);
        return count.toString();
    }
}
